<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Project_model extends MY_Model {
	public function __construct() {
		parent::__construct ( 'project' );
	}
	/**
	 * 创建数据表
	 */
	public function create() {
		$this->drop ();
		$sql = "CREATE TABLE `project` (
  				`pid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '众创项目id',
  				`uid` int(10) unsigned NOT NULL COMMENT '发起人用户ID',
				`cid` int(10) unsigned NOT NULL COMMENT '分类ID',
  				`title` varchar(200) NOT NULL COMMENT '众创项目标题',
  				`logo` varchar(100) NOT NULL COMMENT '图片',
  				`starttime` int(10) unsigned NOT NULL COMMENT '众创开始时间',
  				`addtime` int(10) unsigned NOT NULL COMMENT '众创增量时间',
  				`personNum` int(10) unsigned NOT NULL COMMENT '众创项目最多人数',
  				`grade` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '众创项目级别（0：个人；1：学校）',
  				`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '众创项目状态（0：过时；1：正常）',
  				PRIMARY KEY (`pid`)
				) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT='众创项目表';";
		$re = $this->db->simple_query ( $sql );
	}
	/**
	 * 删除数据表
	 */
	public function drop() {
		$sql = 'DROP TABLE IF EXISTS `project`;';
		$re = $this->db->simple_query ( $sql );
		return $re;
	}
}